package com.ruoyi.web.controller.fee;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.FeeJiancha;
import com.ruoyi.system.service.IFeeJianchaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 检查缴费信息Controller
 * 
 * @author ruoyi
 * @date 2024-06-27
 */
@RestController
@RequestMapping("/fee/jiancha")
public class FeeJianchaController extends BaseController
{
    @Autowired
    private IFeeJianchaService feeJianchaService;

    /**
     * 查询检查缴费信息列表
     */
    @PreAuthorize("@ss.hasPermi('fee:jiancha:list')")
    @GetMapping("/list")
    public TableDataInfo list(FeeJiancha feeJiancha)
    {
        startPage();
        List<FeeJiancha> list = feeJianchaService.selectFeeJianchaList(feeJiancha);
        return getDataTable(list);
    }

    /**
     * 导出检查缴费信息列表
     */
    @PreAuthorize("@ss.hasPermi('fee:jiancha:export')")
    @Log(title = "检查缴费信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, FeeJiancha feeJiancha)
    {
        List<FeeJiancha> list = feeJianchaService.selectFeeJianchaList(feeJiancha);
        ExcelUtil<FeeJiancha> util = new ExcelUtil<FeeJiancha>(FeeJiancha.class);
        util.exportExcel(response, list, "检查缴费信息数据");
    }

    /**
     * 获取检查缴费信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('fee:jiancha:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(feeJianchaService.selectFeeJianchaById(id));
    }

    /**
     * 新增检查缴费信息
     */
    @PreAuthorize("@ss.hasPermi('fee:jiancha:add')")
    @Log(title = "检查缴费信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FeeJiancha feeJiancha)
    {
        return toAjax(feeJianchaService.insertFeeJiancha(feeJiancha));
    }

    /**
     * 修改检查缴费信息
     */
    @PreAuthorize("@ss.hasPermi('fee:jiancha:edit')")
    @Log(title = "检查缴费信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FeeJiancha feeJiancha)
    {
        return toAjax(feeJianchaService.updateFeeJiancha(feeJiancha));
    }

    /**
     * 删除检查缴费信息
     */
    @PreAuthorize("@ss.hasPermi('fee:jiancha:remove')")
    @Log(title = "检查缴费信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(feeJianchaService.deleteFeeJianchaByIds(ids));
    }
}
